package com.situ.be.service.impl;
import java.util.List;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.situ.be.service.BeOrderService;
import com.situ.be.dao.BeOrderDao;
import com.situ.be.common.Assist;
import com.situ.be.entity.BeOrder;
import org.springframework.transaction.annotation.Transactional;

/**
 * BeOrder的服务接口的实现类
 * 
 * @author 胡文 qq:986776
 *
 */
@Service
public class BeOrderServiceImpl implements BeOrderService {
	private final Logger LOG = LogManager.getLogger(this.getClass());

	@Autowired
	private BeOrderDao beOrderDao;

/**
* 查询....
*/
	@Override
	public List<BeOrder> find(BeOrder value) {

		List<BeOrder> result = beOrderDao.selectBeOrderByObj(value);

		return result;
	}
@Override
	public List<BeOrder> find2(BeOrder value) {

		List<BeOrder> result = beOrderDao.selectBeOrderByObj2(value);

		return result;
	}
    /**
* 根据id查询
*/
	@Override
	public BeOrder findOne(String id) {

		BeOrder result = beOrderDao.selectBeOrderById(id);

		return result;
	}

/**
* 添加不为空
*/
	@Override
	public int saveNotNull(BeOrder value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行将BeOrder中属性值不为null的数据保存到数据库-->失败:对象不能为空");
			}
			return 0;
		}
		int result = beOrderDao.insertNotNullBeOrder(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行将BeOrder中属性值不为null的数据保存到数据库-->结果:", result);
		}
		return result;
	}
	@Override
    /**
* 修改不为空
*/
	public int updateNotNullById(BeOrder value) {
		if (value == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过BeOrder的id更新BeOrder中属性不为null的数据-->失败:对象为null");
			}
			return 0;
		}
		int result = beOrderDao.updateNotNullBeOrderById(value);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过BeOrder的id更新BeOrder中属性不为null的数据-->结果:", result);
		}
		return result;
	}
    /**
* 删除
*/
	@Override
	public int deleteById(String id) {
		if (id == null) {
			if (LOG.isDebugEnabled()) {
				LOG.debug("执行通过BeOrder的id删除BeOrder-->失败:id不能为空");
			}
			return 0;
		}
		int result = beOrderDao.deleteBeOrderById(id);
		if (LOG.isDebugEnabled()) {
			LOG.debug("执行通过BeOrder的id删除BeOrder-->结果:", result);
		}
		return result;
	}

	@Override
	@Transactional
	public int addOrder(BeOrder order) {
		return beOrderDao.addOrder(order);
	}


}